Field of the Invention
The present invention relates to an image processing device, a method of controlling the same, a storage medium, and an image pickup apparatus, and more particularly to an image processing device for synthesizing a plurality of images.
Description of the Related Art
In general, when photographing celestial objects, exposure over a long time period e.g. 30 seconds or one minute is performed by taking into consideration the fact that the amount of light from each star is very small. However, each celestial object performs diurnal motion in accordance with the Earth's rotation, and hence the long-time exposure results in forming light trails instead of forming spot images of stars (celestial object).
To avoid formation of light trails, a plurality of images are photographed with such an exposure time period as will prevent stars from forming light trails, the shift of each star between images caused by the diurnal motion of the star is corrected, and then the plurality of images are synthesized into one image. This makes it possible to photograph celestial objects without changing images of stars into light trails, in a manner similar to a case where photographing is performed with long-time exposure.
When correcting the shift of each star between a plurality of images, each of the images is divided into a plurality of blocks, and motion vectors are calculated with respect to each block. Then, the shift is corrected by calculating movement of the image based on the motion vectors.
For example, there has been proposed an image pickup apparatus that determines a total exposure time period according to light intensity of celestial bodies which are an object to be photographed, performs divided exposure N times each over such a time period as will prevent stars from forming light trails, and corrects an image shift (see Japanese Patent Laid-Open Publication No. 2003-259184).
Further, there has been proposed an image pickup apparatus that divides each of a plurality of images into a plurality of blocks, detects, if any block has isolated points each having pixel values different from those of surrounding pixels, motion vectors with respect to the block having isolated points, and corrects an image shift (see Japanese Patent Laid-Open Publication No. 2008-10958).
Incidentally, when calculating a motion vector, there is a case where a motion vector cannot be accurately detected with respect to each of the blocks due to the influence of an external disturbance, such as noise. In this case, according to the methods described in Japanese Patent Laid-Open Publication No. 2003-259184 and Japanese Patent Laid-Open Publication No. 2008-10958, a motion vector detected at a low accuracy is used in calculating the movement of an image. As a result, the image shift cannot be accurately corrected, so that the images are sometimes synthesized in a blurred state.